/* ==================== 基础工具样式 ==================== */
pre:has(+ .xiaobaix-iframe) {
    display: none;
}
/* ==================== 动画效果 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==================== 循环任务样式 ==================== */
.task-container {
    margin-top: 10px;
    margin-bottom: 10px;
}

.task-container:empty::after {
    content: "No tasks found";
    font-size: 0.95em;
    opacity: 0.7;
    display: block;
    text-align: center;
}

.scheduled-tasks-embedded-warning {
    padding: 15px;
    background: var(--SmartThemeBlurTintColor);
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 8px;
    margin: 10px 0;
}

.warning-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px;
    background: rgba(255, 193, 7, 0.1);
    border-left: 3px solid #ffc107;
    border-radius: 4px;
}

.task-item {
    align-items: center;
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 10px;
    padding: 0 5px;
    margin-top: 1px;
    margin-bottom: 1px;
}

.task-item:has(.disable_task:checked) .task_name {
    text-decoration: line-through;
    filter: grayscale(0.5);
}

.task_name {
    font-weight: normal;
    color: var(--SmartThemeEmColor);
    font-size: 0.9em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drag-handle {
    cursor: grab;
    color: var(--SmartThemeQuoteColor);
    margin-right: 8px;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.checkbox {
    align-items: center;
}

.task_editor {
    width: 100%;
}

.task_editor .flex-container {
    gap: 10px;
}

.task_editor textarea {
    font-family: 'Courier New', monospace;
}

input.disable_task {
    display: none !important;
}

.task-toggle-off {
    cursor: pointer;
    opacity: 0.5;
    filter: grayscale(0.5);
    transition: opacity 0.2s ease-in-out;
}

.task-toggle-off:hover {
    opacity: 1;
    filter: none;
}

.task-toggle-on {
    cursor: pointer;
}

.disable_task:checked~.task-toggle-off {
    display: block;
}

.disable_task:checked~.task-toggle-on {
    display: none;
}

.disable_task:not(:checked)~.task-toggle-off {
    display: none;
}

.disable_task:not(:checked)~.task-toggle-on {
    display: block;
}

/* ==================== 沉浸式显示模式样式 ==================== */
body.immersive-mode #chat {
    padding: 0 !important;
    border: 0px !important;
    overflow-y: auto;
    margin: 0 0px 0px 4px !important;
    scrollbar-width: thin;
    scrollbar-gutter: auto;
}

.xiaobaix-top-group {
    margin-top: 1em !important;
}

@media screen and (min-width: 1001px) {
    body.immersive-mode #chat {
        scrollbar-width: none;
        -ms-overflow-style: none;
        /* IE and Edge */
    }

    body.immersive-mode #chat::-webkit-scrollbar {
        display: none;
    }
}

body.immersive-mode .mesAvatarWrapper {
    margin-top: 1em;
    padding-bottom: 0px;
}

body.immersive-mode .swipe_left,
body.immersive-mode .swipeRightBlock {
    display: none !important;
}

body.immersive-mode .mes {
    margin: 2% 0 0% 0 !important;
}

body.immersive-mode .ch_name {
    padding-bottom: 5px;
    border-bottom: 0.5px dashed color-mix(in srgb, var(--SmartThemeEmColor) 30%, transparent);
}

body.immersive-mode .mes_block {
    padding-left: 0 !important;
    margin: 0 0 5px 0 !important;
}

body.immersive-mode .mes_text {
    padding: 0px !important;
    max-width: 100%;
    width: 100%;
    margin-top: 5px;
}

body.immersive-mode .mes {
    width: 99%;
    margin: 0 0.5%;
    padding: 0px !important;
}

body.immersive-mode .mes_buttons,
body.immersive-mode .mes_edit_buttons {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
}

body.immersive-mode .mes_buttons {
    height: 20px;
    overflow-x: clip;
}

body.immersive-mode .swipes-counter {
    padding-left: 0px;
    margin-bottom: 0 !important;
}

body.immersive-mode .flex-container.flex1.alignitemscenter {
    min-height: 32px;
}

.immersive-navigation {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 5px;
    opacity: 0.7;
}

.immersive-nav-btn {
    color: var(--SmartThemeBodyColor);
    cursor: pointer;
    transition: all 0.2s ease;
    background: none;
    border: none;
    font-size: 12px;
}

.immersive-nav-btn:hover:not(:disabled) {
    background-color: rgba(var(--SmartThemeBodyColor), 0.2);
    transform: scale(1.1);
}

.immersive-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ==================== 模板编辑器样式 ==================== */
.xiaobai_template_editor {
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    border-radius: 8px;
}

.template-replacer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.template-replacer-title {
    font-weight: bold;
    color: var(--SmartThemeEmColor, #007bff);
}

.template-replacer-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.template-replacer-status {
    font-size: 12px;
    color: var(--SmartThemeQuoteColor, #888);
    font-style: italic;
}

.template-replacer-status.has-settings {
    color: var(--SmartThemeEmColor, #007bff);
}

.template-replacer-status.no-character {
    color: var(--SmartThemeCheckboxBgColor, #666);
}

.example-text {
    font-size: 0.9em;
    color: var(--SmartThemeQuoteColor, #888);
}

.example-text p {
    margin: 5px 0;
    text-align: left !important;
}

.example-text strong {
    color: var(--SmartThemeEmColor);
}

/* ==================== 消息预览插件样式 ==================== */
#message_preview_btn {
    width: var(--bottomFormBlockSize);
    height: var(--bottomFormBlockSize);
    margin: 0;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 300ms;
    color: var(--SmartThemeBodyColor);
    font-size: var(--bottomFormIconSize);
}

#message_preview_btn:hover {
    opacity: 1;
    filter: brightness(1.2);
}

.message-preview-popup {
    max-height: 82vh;
    overflow-y: auto;
    padding: 10px;
}

.message-preview-content-box {
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    white-space: pre-wrap;
    max-height: 82vh;
    overflow-y: auto;
    padding: 15px;
    background: #000000 !important;
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 5px;
    color: #ffffff !important;
    font-size: 12px;
    line-height: 1.4;
    text-align: left;
    padding-bottom: 80px;
}

.mes_history_preview {
    opacity: 0.6;
    transition: opacity 0.2s ease-in-out;
}

.mes_history_preview:hover {
    opacity: 1;
}

/* ==================== auto-backgroung样式 ==================== */
.settings-menu {
    display: flex;
    margin-bottom: 10px;
    border-bottom: 1px solid #444;
}

.menu-tab {
    flex: 1;
    padding: 2px 8px;
    text-align: center;
    cursor: pointer;
    color: #ccc;
    border: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

.menu-tab:hover {
    color: #fff;
}

.menu-tab.active {
    color: #007acc;
    border-bottom: 2px solid #007acc;
}

.settings-section {
    padding: 10px 0;
}

.template-replacer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.template-replacer-title {
    font-weight: bold;
    color: #007acc;
}

.template-replacer-status {
    padding: 5px 10px;
    background: #2a2a2a;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.template-replacer-status.has-settings {
    background: #1a4a1a;
    color: #90ee90;
}

.template-replacer-status.no-character {
    background: #4a1a1a;
    color: #ffb3b3;
}

.custom-tags-container {
    margin-top: 10px;
}

.custom-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    min-height: 20px;
    padding: 8px;
    background: #2a2a2a;
    border-radius: 4px;
    border: 1px solid #444;
}

.custom-tag-item {
    display: flex;
    align-items: center;
    background: #007acc;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    gap: 6px;
}

.custom-tag-text {
    font-weight: 500;
}

.custom-tag-remove {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    font-weight: bold;
    transition: color 0.2s ease;
}

.custom-tag-remove:hover {
    color: #ff6b6b;
}

.custom-tags-empty {
    color: #888;
    font-style: italic;
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

/* ==================== 角色卡自动更新样式 (Character Updater) ==================== */
.character-menu-overlay.shadow_popup {
  z-index: 9999;
}
.character-menu-overlay .character-menu-content {
  pointer-events: auto;
}
.shadow_popup_open #some-settings-drawer-selector {
}

.prb-popup-container .menu_button,
.prb-actions .menu_button,
.task_editor .menu_button{
  white-space: nowrap;
}

.prb-list {
    padding: 4px;
}

.prb-chip .remove {
    cursor: pointer;
    color: #f43f5e
}

.prb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px
}

.prb-popup-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    max-height: 500px;
    overflow-y: auto;
}

.xiaobaix-confirm-content {
    width:80%;
}

.message-preview-content-box::-webkit-scrollbar-thumb:hover,
.xiaobai_template_editor::-webkit-scrollbar-thumb:hover {
    background: var(--SmartThemeAccent);
}


.littlewhitebox .current-character-info {
    background: var(--SmartThemeBlurTintColor);
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 5px;
    padding: 10px;
    margin: 0px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.littlewhitebox .current-character-info:hover {
    background: var(--SmartThemeBorderColor);
    border-color: var(--SmartThemeBodyColor);
}

.littlewhitebox .current-character-name {
    font-weight: 500;
    color: var(--SmartThemeBodyColor);
    font-size: var(--mainFontSize);
}

.littlewhitebox .character-status {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.littlewhitebox .character-status.bound {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.littlewhitebox .character-status.unbound {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    border: 1px solid #f1c40f;
}

/* 角色列表更新通知样式 - 在角色列表页面 */
.character-update-notification {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(46, 204, 113, 0.9);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 5px;
    white-space: nowrap;
}

.update-container .menu_button {
    width: auto;
}

.character-update-notification:hover {
    background: rgba(46, 204, 113, 1);
    transform: scale(1.05);
}

.character-update-notification i {
    font-size: 9px;
    color: white;
}

.character-update-notification small {
    font-size: 9px;
    font-weight: 500;
    color: white;
    margin: 0;
    opacity: 1;
}

#character-updater-edit-button {
    color: var(--SmartThemeBodyColor);
    filter: grayscale(0.5);
    background-color: var(--SmartThemeBlurTintColor);
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 5px;
    cursor: pointer;
    transition: var(--animation-duration-2x);
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px;
    margin: 0;
}

#character-updater-edit-button:hover:not(:disabled) {
    filter: grayscale(0);
    background-color: var(--SmartThemeBorderColor);
}

#character-updater-edit-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#character-updater-edit-button.has-update {
    color: #2ecc71;
    filter: grayscale(0);
}

#character-updater-edit-button.has-update:hover:not(:disabled) {
    background-color: rgba(46, 204, 113, 0.2);
    border-color: #2ecc71;
}

.character-menu-content .menu-footer .menu_button {
    width: fit-content;
    display: flex;
    gap: 10px;
    flex-direction: row;
}

/* ==================== 菜单覆盖层样式 - 全局 ==================== */
.character-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.character-menu-content {
    background: var(--SmartThemeBlurTintColor);
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(var(--SmartThemeBlurStrength));
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--SmartThemeBorderColor);
    background: var(--SmartThemeBlurTintColor);
    border-radius: 10px 10px 0 0;
}

.menu-header h3 {
    margin: 0;
    color: var(--SmartThemeBodyColor);
    font-size: 18px;
    font-weight: 600;
}

.menu-close {
    background: none;
    border: none;
    color: var(--SmartThemeBodyColor);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.menu-close:hover {
    background: var(--SmartThemeBorderColor);
}

.menu-body {
    padding: 20px;
}

.menu-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--SmartThemeBorderColor);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: var(--SmartThemeBlurTintColor);
    border-radius: 0 0 10px 10px;
}

/* ==================== UUID显示样式 ==================== */
.uuid-display {
    background: var(--SmartThemeBlurTintColor);
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
}

.uuid-display label {
    display: block;
    color: var(--SmartThemeBodyColor);
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 5px;
}

.uuid-value {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--SmartThemeBodyColor);
    background: rgba(0, 0, 0, 0.1);
    padding: 5px 8px;
    border-radius: 3px;
    word-break: break-all;
    display: block;
}

/* ==================== 表单组样式 ==================== */
.menu-body .form-group {
    margin-bottom: 15px;
}

.menu-body .form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--SmartThemeBodyColor);
    font-weight: 500;
    font-size: 13px;
    text-align: left;
}

.menu-body input[type="text"],
.menu-body input[type="password"],
.menu-body input[type="url"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 5px;
    background: var(--SmartThemeBlurTintColor);
    color: var(--SmartThemeBodyColor);
    font-size: 13px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.menu-body input[type="text"]:focus,
.menu-body input[type="password"]:focus,
.menu-body input[type="url"]:focus {
    outline: none;
    border-color: var(--SmartThemeBodyColor);
}

/* ==================== 菜单按钮样式 ==================== */
.menu-button {
    padding: 8px 16px;
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 80px;
}

.confirm-button {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

.confirm-button:hover:not(:disabled) {
    background: #219a52;
    border-color: #219a52;
}

.confirm-button:disabled {
    background: #95a5a6;
    border-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

.silent-update-button {
    background: #f39c12;
    color: white;
    border-color: #f39c12;
}

.silent-update-button:hover:not(:disabled) {
    background: #e67e22;
    border-color: #e67e22;
}

.silent-update-button:disabled {
    background: #95a5a6;
    border-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

.cancel-button {
    background: var(--SmartThemeBlurTintColor);
    color: var(--SmartThemeBodyColor);
}

.cancel-button:hover {
    background: var(--SmartThemeBorderColor);
}

/* ==================== 更新弹窗样式 ==================== */
.character-update-popup {
    padding: 20px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    color: var(--SmartThemeBodyColor);
}

.character-update-popup h3 {
    margin: 0 0 15px 0;
    color: var(--SmartThemeBodyColor);
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid var(--SmartThemeBorderColor);
    padding-bottom: 10px;
}

.character-update-popup .update-status {
    margin-bottom: 15px;
}

.character-update-popup .update-status .status-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 5px;
    font-weight: 500;
}

.character-update-popup .update-status .status-success {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.character-update-popup .update-status .status-success i {
    color: #2ecc71;
}

.character-update-popup .update-status .status-update {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
    border: 1px solid #f39c12;
}

.character-update-popup .update-status .status-update i {
    color: #f39c12;
}

.character-update-popup .update-description {
    margin-bottom: 15px;
}

.character-update-popup .update-description strong {
    display: block;
    margin-bottom: 5px;
    color: var(--SmartThemeBodyColor);
    font-weight: 600;
}

.character-update-popup .update-description p {
    margin: 0;
    padding: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    font-style: italic;
    color: var(--SmartThemeBodyColor);
    opacity: 0.9;
    max-height: 120px;
    overflow-y: auto;
    word-wrap: break-word;
}

.character-update-popup .update-timestamps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.character-update-popup .update-timestamps div {
    background: var(--SmartThemeBlurTintColor);
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 5px;
    padding: 10px;
    font-size: 13px;
}

.character-update-popup .update-timestamps strong {
    display: block;
    margin-bottom: 3px;
    color: var(--SmartThemeBodyColor);
    font-weight: 500;
}

.character-update-popup .popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.character-update-popup .popup-actions button {
    background: var(--SmartThemeBlurTintColor);
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 5px;
    padding: 8px 15px;
    color: var(--SmartThemeBodyColor);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    text-decoration: none;
}

.character-update-popup .popup-actions button:hover {
    background: var(--SmartThemeBorderColor);
    border-color: var(--SmartThemeBodyColor);
}

.character-update-popup .popup-actions button i {
    font-size: 12px;
}

.character-update-popup .no-link-message {
    padding: 10px;
    background: var(--SmartThemeBlurTintColor);
    border: 1px solid var(--SmartThemeBorderColor);
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
    color: var(--SmartThemeBodyColor);
    opacity: 0.7;
    font-style: italic;
}

/* ==================== 响应式样式 ==================== */
@media screen and (max-width: 1000px) and (min-width: 481px) {
    .character-menu-overlay {
        padding: 2rem 1rem;
    }

    .character-menu-content {
        max-width: 600px;
    }

    .menu-footer {
        justify-content: flex-end;
    }
}

@media screen and (max-width: 480px) {
    .character-menu-overlay {
        align-items: flex-start;
        padding: 2rem 1rem;
    }

    .character-menu-content {
        margin-top: 2rem;
        max-height: calc(100vh - 4rem);
        width: 100%;
        max-width: none;
    }

    .menu-header h3 {
        font-size: 16px;
    }

    .menu-body {
        padding: 15px;
    }

    .menu-footer {
        flex-wrap: wrap;
        justify-content: center;
    }

    .menu-footer button {
        flex: 1;
        min-width: 100px;
        margin: 5px;
    }
}

/* ==================== 滚动条样式 ==================== */
.message-preview-content-box::-webkit-scrollbar,
.xiaobai_template_editor::-webkit-scrollbar {
    width: 5px;
}

.message-preview-content-box::-webkit-scrollbar-track,
.xiaobai_template_editor::-webkit-scrollbar-track {
    background: var(--SmartThemeBlurTintColor);
    border-radius: 3px;
}

.message-preview-content-box::-webkit-scrollbar-thumb,
.xiaobai_template_editor::-webkit-scrollbar-thumb {
    background: var(--SmartThemeBorderColor);
    border-radius: 3px;

}


